package com.cslg.yougou.front.controller;
import com.cslg.yougou.front.pojo.Result;
import com.cslg.yougou.front.service.YougouGoodsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zyw
 * @since 2020-11-06
 */
@RestController
@RequestMapping("/front/yougou-goods")
@Api(value="用户controller",tags={"商品接口"})
public class YougouGoodsController {
    @Autowired
    YougouGoodsService yougouGoodsService;
    @GetMapping("/getGoods")
    public Result getGoods(@ApiParam(value = "用户类型id",required = true)Integer goodsTypeId,
                           @ApiParam(value = "一页多少条",required = true)Integer pageSize,
                           @ApiParam(value = "当前页数",required = true)Integer currentPage){
        return yougouGoodsService.getGoods(goodsTypeId,pageSize,currentPage);
    }
    @GetMapping("/getGoodDetail")
    public Result getGoodDetail(@ApiParam(value = "用户的商品id",required = true)Integer goodsId){
        return yougouGoodsService.getGoodsDetail(goodsId);
    }
    @GetMapping("/getUserLikeGoods")
    @ApiOperation(value = "getUserLikeGoods",notes = "查询数据库中的记录",httpMethod = "get",response = Result.class)
    public Result getUserLikeGoods(@ApiParam(value = "一页多少条",required = true)Integer pageSize,
                                   @ApiParam(value = "当前页数",required = true) Integer currentPage){
        return yougouGoodsService.getUserLikeGoods(pageSize,currentPage);
    }
}
